package com.pswv2.plane;

import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class PlaneUtil {
	public Map<String, Object> time(Long startTime,Long takeoff,Long length){
		Map<String, Object> map1 = new HashMap<>();
		Calendar calendar = Calendar.getInstance();
		int t1=6;
		int t2=9;
		int t3=11;
		int t4=13;
		int t5=5;
		int t6=8;
		Date b= new Date(takeoff);
		int d=(int) (length/60);
		calendar.setTime(b);
		int hour=calendar.get(Calendar.HOUR_OF_DAY);
		int ts=d+1;
		int tss=hour-ts;
		if(t1<tss&&tss<t2){
			map1.put("startime", "你需要提前"+ts+"小时出发不然你会错过航班");
			map1.put("advancetime", "应该选择在"+tss+"点出发");
			map1.put("s1", "你可能会错过早饭点");
			map1.put("s2", "你可以选择提前吃饭或是在赶飞机的途中吃饭");
			map1.put("s3", "也可以选择在到机场吃饭");
			return map1;
		}
		if(t3<tss&&tss<t4){
			map1.put("startime", "你需要提前"+ts+"小时出发不然你会错过航班");
			map1.put("advancetime", "应该选择在"+tss+"点出发");
			map1.put("s1", "你可能会错过中午饭点");
			map1.put("s2", "你可以选择提前吃饭或是在赶飞机的途中吃饭");
			map1.put("s3", "也可以选择在到机场吃饭");
			return map1;
		}
		if(t5<tss&&tss<t6){
			map1.put("startime", "你需要提前"+ts+"小时出发不然你会错过航班");
			map1.put("advancetime", "应该选择在"+tss+"点出发");
			map1.put("s1", "你可能会错过晚饭点");
			map1.put("s2", "你可以选择提前吃饭或是在赶飞机的途中吃饭");
			map1.put("s3", "也可以选择在到机场吃饭");
			return map1;
		}
		
		map1.put("startime", "你需要提前"+ts+"小时出发不然你会错过航班");
		map1.put("advancetime", "应该选择在"+tss+"点出发");
		map1.put("s1", "");
		map1.put("s2", "");
		map1.put("s3", "");
		return map1;
	}
}
